package org.hs.phd.odi.tracking;

import java.awt.Rectangle;

import javax.swing.UnsupportedLookAndFeelException;

import org.hs.phd.common.framesource.FolderFrameSource;
import org.hs.phd.common.framesource.FrameSource;
import org.hs.phd.odi.tracking.ui.DefaultTrackingView;
import org.hs.phd.odi.tracking.ui.TrackingPresenter;
import org.hs.phd.odi.transformation.ODITransformation;
import org.hs.phd.odi.transformation.ParaCatadioptricTransformation;


public class TrackingMain {

    public static void main(String[] args) throws Exception{
        setNimbusLAFIfAvailable();

        FrameSource frameSource = new FolderFrameSource(
                "D:\\Hakan_PhD\\Data\\OwnData\\KAYIT_20111123\\KAYIT_dia6_exp512\\renamed\\Image",
                ".jpg", 4125);
        frameSource.setROI(new Rectangle(205, 85, 1019, 874));
        frameSource.setFlip(FrameSource.FlipType.FLIP_AROUND_Y_AXIS);
        
        ODITransformation transformation = new ParaCatadioptricTransformation(510, 510, 400, true);

        TrackingPresenter presenter = new TrackingPresenter(new DefaultTrackingView(), frameSource, transformation);
        presenter.start();
    }

	private static void setNimbusLAFIfAvailable()
			throws ClassNotFoundException, InstantiationException,
			IllegalAccessException, UnsupportedLookAndFeelException {
		javax.swing.UIManager.LookAndFeelInfo[] installedLookAndFeels = javax.swing.UIManager.getInstalledLookAndFeels();
        for (int idx = 0; idx < installedLookAndFeels.length; idx++) {
            if ("Nimbus".equals(installedLookAndFeels[idx].getName())) {
                javax.swing.UIManager.setLookAndFeel(installedLookAndFeels[idx].getClassName());
                break;
            }
        }
	}
}
